package com.transaction.bytetcc.service.impl;

import com.transaction.bytetcc.service.IAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("accountConfirmService")
public class AccountServiceImpl implements IAccountService{

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    @Transactional
    public void increaseAmount(String accountId, double amount) {
        jdbcTemplate.update("update tb_account_one set amount = amount + ?, frozen = frozen - ? where acct_id = ?", amount, amount, accountId);
    }


}
